package com.hwang.mvc.pojo;

import java.lang.reflect.Method;
import java.util.*;
import java.util.regex.Pattern;

/**
 * @author hwangrq
 * @date 2021/2/19 22:12
 * @description 封装handler方法相关的信息
 */
public class Handler {

    /**
     * method.invoke(obj,)
     */
    private Object controller;


    private Method method;

    /**
     * spring中url是支持正则的
     */
    private Pattern pattern;

    /**
     * 参数顺序,是为了进行参数绑定，
     * key是参数名，value代表是第几个参数
     * <name,2>
     */
    private Map<String, Integer> paramIndexMapping = new HashMap<>();

    private Set<String> security = new HashSet<>();

    public Set<String> getSecurity() {
        return security;
    }

    public void setSecurity(Set<String> security) {
        this.security = security;
    }

    public Object getController() {
        return controller;
    }

    public void setController(Object controller) {
        this.controller = controller;
    }

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        this.method = method;
    }

    public Pattern getPattern() {
        return pattern;
    }

    public void setPattern(Pattern pattern) {
        this.pattern = pattern;
    }

    public Map<String, Integer> getParamIndexMapping() {
        return paramIndexMapping;
    }

    public void setParamIndexMapping(Map<String, Integer> paramIndexMapping) {
        this.paramIndexMapping = paramIndexMapping;
    }
}
